home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 222_01 / cc.doc < prev    next >
Text File  |  1980-01-01  |  18KB  |  461 lines

  1.  
  2.             S m a l l  -   C     D o c u m e n t a t i o n
  3.  
  4.  
  5.                   V e r s i o n     2.70     10/30/86
  6.  
  7.                              by
  8.  
  9.                       F. A. Scacchitti
  10.                       25 Glenview Lane
  11.                       Rochester, NY 14609
  12.                       (716) 482 - 7159
  13.  
  14.  
  15. This  document  is intended to supplement J.  E.  Hendrix's  "The 
  16. Small  C Handbook" and will only discuss the differences  between 
  17. this version of Small C and that described in the Manual.  It  is 
  18. recommended  the  user  purchase  Hendrix's  manual  for  a  more 
  19. complete treatment of Small C.
  20.  
  21. For information regarding the contents and structure of the Small 
  22. C library, refer to the file CLIB.DOC and Hendrix's Manual.
  23.  
  24. This  compiler was originally Version 2.1 as obtained from  J.  E 
  25. Hendrix.  It  includes all of his newsletter  fixes/enhancements. 
  26. Refer  to the file CC.DEF for a complete chronological history of 
  27. changes and details regarding modules or functions changed.  Also 
  28. it  is  assumed the user is somewhat familiar  with  the  M80/L80 
  29. software.  The  compiler  produces  an output  file  of  assembly 
  30. language pneumonics which must be assembled and linked.
  31.  
  32. This  compiler  is  a superset of J.  E.  Hendrix's  Version  2.1 
  33. compiler,  yet  still a subset of C as described by Kernigan  and 
  34. Ritchie in "The C Programming Manual". The following enhancements 
  35. have been installed:
  36.  
  37.    2.1 --> 2.2
  38.  
  39.        * - CP/M runtime package and I/O library to optimize  size 
  40.            and speed
  41.        * - Global initialization option -i
  42.        * - No boot option -n
  43.        * - external static Type Specifiers
  44.        * - Conditional operator {expr1 ? expr2 : expr3}
  45.  
  46.  
  47.    2.2 --> 2.3
  48.  
  49.        * - added multiple levels of indirection
  50.            eg. **char c; ***int ident;  ****var = **c;
  51.  
  52.  
  53.    2.3 --> 2.4
  54.  
  55.        * - improved multiple levels of indirection to ensure 
  56.            appropriate element is stored or retrieved
  57.  
  58.  
  59.    2.4 --> 2.5
  60.  
  61.        * - added arrays of pointers
  62.            eg. char *argv[]; int **i[20]; *i[2] = 22;
  63.        * - added hex and octal constants
  64.            eg. 0x1a, 0XFA, 03777, 00017
  65.  
  66.  
  67.    2.5 --> 2.6
  68.  
  69.        * - added global multidimensional arrays
  70.            eg. char arc[5][5]; int i[3][4][5]; var=i[2][0][3];
  71.  
  72.  
  73.    2.6 --> 2.7 (Released 10/86 for public consumption)
  74.  
  75.        * - added nested includes
  76.        * - new runtime library (rdrtl.rel) for compiler and/or
  77.            redirected output
  78.        * - new i/o library (clib.rel)
  79.  
  80.  
  81. Planned   2.7 --> 2.8 (In final stages)
  82.  
  83.        * - install floating point (float and double)
  84.            (only for Z80 microprocessors)
  85.        * - allow function definition syntax
  86.        * - add compiler error tracker/counter
  87.  
  88.  
  89. Planned   2.8 --> 2.9 (schemes developed)
  90.  
  91.        * - add typedefs, sizeof, unsigned integers
  92.  
  93.  
  94. Planned   2.9 --> 3.0 (matter of parsing) (2nd quarter '87)
  95.  
  96.        * - allow auto, register, short declarations
  97.            (This will be a release version and the final one
  98.             for CP/M)
  99.  
  100.  
  101. Planned   CP/M 3.0 --> MSDOS 3.0 (3rd quarter '87)
  102.  
  103.        * - using J. E. MSDOS version upgrade to my version 3.0
  104.            (will contain floating point, if I can obtain a good 
  105.             package for MSDOS)
  106.  
  107.  
  108. Planned   MSDOS 3.0 --> MSDOS 4.0 (not started) (4th quarter '87)
  109.  
  110.        * - add longs, unions and structures
  111.  
  112. This  is  an  aggressive schedule (slips are  possible),  but  at 
  113. completion  should be a full implementation of C.  If anyone  has 
  114. any  suggestions or has already accomplished that  which  remains 
  115. undone here, don't hesitate to contact me. I have no qualms about 
  116. collaborating to finish the job or optimize compiler operation.
  117.  
  118.  
  119.  
  120. FEATURES and ENHANCEMENTS
  121.  
  122.  
  123. * - Global initialization option -i
  124.  
  125. This  feature decreases compilation time,  especially when  large 
  126. arrays are declared globally.  Most versions of the compiler  (at 
  127. least  the  ones I've seen),  by default,  initialize all  global 
  128. variables to zero by generating either DB 0 or DW 0.  Arrays  are 
  129. initialized via DB 0, 0, 0, 0, 0, 0, . . . . . . . . . .
  130. This  adds significantly to compile time if the user has declared 
  131. large  global  arrays.  The  compiler  now issues  a  DS  n  thus 
  132. allocating n bytes of uninitialized memory.  If the -i switch  is 
  133. used,  memory  will  be  initialized to zeroes as  before.  As  a 
  134. furthur  example, the Eratosthenes Prime Number  Sieve  takes  80 
  135. seconds to compile when the -i switch is used but only 17 seconds 
  136. if  it isn't.  An additional 55 seconds is required with each for 
  137. assembly and linking.
  138.  
  139.  
  140. * - No boot option -n
  141.  
  142. This  feature allows rapid return to the CP/M prompt  on  program 
  143. completion  at a cost of 800h bytes of code space.  It is used in 
  144. conjunction with the runtime package in the C library (CLIB.REL). 
  145. If  the the -n switch is used and the program contains  a  main() 
  146. function,  DB ZZZCCP 1 will be generated by the compiler prior to 
  147. the  END statement.  If it isn't specified the compiler generates 
  148. DB  ZZZCCP  0.  The global variable ZZZCCP determines  where  the 
  149. stack should be placed and the return path to CP/M.  In short, if 
  150. the -n option is used the stack is placed at the base of the  CCP 
  151. and the program returns to CP/M via a return instruction.  If the 
  152. -n  option isn't specified the stack is placed at the base of the 
  153. BDOS and return is performed via a warm boot.  Refer to  CLIB.DOC 
  154. and  ULINK.MAC  for details regarding operation of this  feature. 
  155. This feature is NOT recommended for use with programs  performing 
  156. disk i/o, but was intended primarily for non-disk utilities.
  157.  
  158.  
  159. * - external static Type Specifiers
  160.  
  161. Global  variables  are more rapidly accessed (both  fetching  and 
  162. storing)  and require less code to access than  local  variables. 
  163. Refer   to  Chapter  19  of  Hendrix's  manual  for  a   complete 
  164. explanation.  Most Small C compilers make all global declarations 
  165. public.  This  obviously  presents a problem (especially for  the 
  166. variables c and i) in taking full advantage of this feature.  The 
  167. static type specifier implies that the variable should be  memory 
  168. resident, yet known only to the module it is compiled in. This is 
  169. accomplished  simply  by  generating  a single  colon  for  types 
  170. specified as static and the original double colon for those  that 
  171. are  not.  This  results in variables that are local only to  the 
  172. file  in which they are compiled.  It is ideal for  non-recursive 
  173. library functions.
  174.  
  175.  
  176. * - Conditional operator {expr1 ? expr2 : expr3}
  177.  
  178. This  is just another enhancement to bring Small C closer to  Big 
  179. C.  This  operator  is described quite thoroughly in  Kernigan  & 
  180. Ritchie's  "The  C Programming Language" and works as  specified. 
  181. The  user  should  try the examples in  thier  manual.  The  code 
  182. generated  by this operator is almost exactly the same as an  if-
  183. else statement, however if does lead to more succinct and elegant 
  184. code  at the source level and can be used inside statements where 
  185. if - else fears to tread.
  186.  
  187.  
  188. * - added multiple levels of indirection
  189.  
  190. This was always a sore spot with me.  Now your program can use  a 
  191. standard  argc,  argv syntax.  (int argc;  char **argv;) It  also 
  192. generates  more  efficient  and  shorter  code  since  additional 
  193. argument  assignments  aren't necessary when  accessing  extended 
  194. levels of a pointer. 
  195.  
  196.  
  197. * - added arrays of pointers
  198.  
  199. One more step toward standardization with full C.  The programmer 
  200. may use char **argv;  or char *argv[];  and/or retrieve/store  as 
  201. specified by K & R.
  202.  
  203.  
  204. * - added hex and octal constants
  205.  
  206. Works as described by K & R. NO longer any need for that decimal-
  207. hexadecimal-octal calculator on the shelf. (Well at least not for 
  208. figuring contants and addresses for your small c program.)
  209.  
  210.  
  211. * - added global multidimensional arrays
  212.  
  213. Some  programs almost demand this capability.  However,  there is 
  214. some overhead involved in using multi-dimmed arrays and the  code 
  215. generated  can  be  larger than if  multiple  single  dimensione